﻿<%@ Page Language="C#" AutoEventWireup="true" Theme="Default" CodeBehind="YonghuYJDZDY.aspx.cs" Inherits="Web.Pages.QuShui.DiXiaS._8.QiTaGL.YonghuYJDZDY" %>

<%@ Register Assembly="DevExpress.Web.v15.2, Version=15.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>用户邮寄地址打印</title>
    <script src="/JS/AddEditCancel.js"></script>
    <script src="/JS/jquery.js"></script>
    <script type="text/javascript">
        var typenum = 1;
        //开始上传文件
        function Uploader_OnUploadStart() {
            //验证文件类型
            LoadPanel.Show();

        }
        var times = 0;

        function Uploader_OnFilesUploadComplete(args) {
           
            if (args.isValid) {
                if (parseInt(args.callbackData) < 0) {
                    alert('文件上传失败');
                    btnDaoRu.SetEnabled(false);
                }
                else {
                    btnDaoRu.SetEnabled(true);
                    txtPath.SetText(args.callbackData.split('|')[0]);
                    HidList.Set("path", args.callbackData.split('|')[1]);

                    return;
                }

                
            }
        }
        function BindCheck(type)
        {
            
            if (type == 1) {
                if (txtStartNo.GetText() != "" && isAllNum(txtEndNo.GetText())) {
                    BtnXZ.OnClick();
                }
            }
            else {
                if (txtStartNo1.GetText() != "")
                {
                    BtnXZ.OnClick();
                }
            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <div>
                    <dx:ASPxLoadingPanel ID="ASPxLoadingPanel1" ClientInstanceName="LoadPanel" runat="server" ContainerElementID="gvList" Modal="true" Theme="Metropolis" ShowImage="false" Text="加载中"></dx:ASPxLoadingPanel>

                    <div class="tabletitle1" align="center">
                        用户邮寄地址打印
                    </div>
                    <table style="width: 100%">
                        <tr>
                            <td style="width: 80px" align="right">Excel路径：
                            </td>
                            <td>
                                <dx:ASPxTextBox ID="txtPath" Width="100%" ReadOnly="true" ClientInstanceName="txtPath" runat="server">
                                    
                                </dx:ASPxTextBox>
                                 <dx:ASPxHiddenField ID="HidList" ClientInstanceName="HidList" runat="server"></dx:ASPxHiddenField>

                            </td>
                            <td style="width:80px">
                                <dx:ASPxUploadControl ID="UpLoadFile" runat="server" ClientInstanceName="uploader"
                                    NullText="请选择文件" ShowTextBox="false" OnFileUploadComplete="UpLoadFile_FileUploadComplete"
                                    ShowClearFileSelectionButton="false" Theme="Aqua1" UploadMode="Advanced"
                                    Width="100%">
                                    <BrowseButton Text="选择"></BrowseButton>
                                    <ClientSideEvents TextChanged="function(s, e) { uploader.Upload();}"
                                        FileUploadComplete="function(s, e) { Uploader_OnFilesUploadComplete(e); }" />
                                    <ValidationSettings AllowedFileExtensions=".xls,.xlsx" MaxFileSizeErrorText="2500000000" NotAllowedFileExtensionErrorText="只能上传EXCEL文件">
                                    </ValidationSettings>
                                </dx:ASPxUploadControl>
                            </td>
                            <td style="width: 10px"></td>
                            <td style="width: 80px">
                                <dx:ASPxButton ID="btnDaoRu" OnClick="btnDaoRu_Click" ClientInstanceName="btnDaoRu"  runat="server" Text="导入"
                                    UseSubmitBehavior="false">
                                    <ClientSideEvents Click="function(s,e){LoadPanel.SetText('正在导入...');LoadPanel.Show();}" />
                                </dx:ASPxButton>
                            </td>
                        </tr>

                    </table>
                    <table style="width: 100%">
                        <tr>
                            <td style="width: 80px" align="right">用户号：</td>
                            <td>
                                <dx:ASPxTextBox ID="txtYongHuH" Width="100%" ClientInstanceName="txtYongHuH" runat="server" MaxLength="15">
                                    <ClientSideEvents KeyPress="function(s,e){if(event.keyCode==13){BtnSearch.OnClick()};}" />
                                </dx:ASPxTextBox>
                            </td>
                            <td>&nbsp;&nbsp;
                        <dx:ASPxButton ID="BtnSearch" ClientInstanceName="BtnSearch" OnClick="BtnSearch_Click" runat="server" Text="查询"
                            UseSubmitBehavior="false">
                            <ClientSideEvents Click="function(s,e){LoadPanel.SetText('正在查询...');LoadPanel.Show();}" />
                        </dx:ASPxButton>
                            </td>
                            <td runat="server" id="pagetotal" style="width: 50%"></td>

                        </tr>
                    </table>
                    <div id="divList" align="center">
                        <div>
                            <dx:ASPxGridView ID="gvList"   SettingsBehavior-AllowSort="false" ClientInstanceName="gvList" runat="server" AutoGenerateColumns="False" KeyFieldName="S_YONGHUH" Theme="Aqua1" Width="100%">
                                <Columns>
                                    <dx:GridViewDataTextColumn Caption="选择" CellStyle-HorizontalAlign="Center" Width="5%">
                                        <DataItemTemplate>
                                            <asp:HiddenField ID="hid" runat="server" Value='<%#Eval("S_YONGHUH") %>' />
                                            <asp:HiddenField ID="S_YONGHUM" runat="server" Value='<%#Eval("S_YONGHUM") %>' />
                                            <asp:HiddenField ID="S_DIZHI" runat="server" Value='<%#Eval("S_DIZHI") %>' />
                                            <asp:HiddenField ID="S_YOUBIAN" runat="server" Value='<%#Eval("S_YOUBIAN") %>' />
                                            <dx:ASPxCheckBox ID="cid" runat="server"></dx:ASPxCheckBox>
                                        </DataItemTemplate>

                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="S_YONGHUH" Caption="用户号" Width="10%">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="S_YONGHUM" Caption="用户名" Width="25%">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="S_DIZHI" Caption="用户地址" Width="50%">
                                    </dx:GridViewDataTextColumn>
                                    <dx:GridViewDataTextColumn FieldName="S_YOUBIAN" Caption="邮政编码" Width="10%">
                                    </dx:GridViewDataTextColumn>
                                </Columns>
                               <SettingsBehavior AllowSelectByRowClick="true" />
                                <Settings VerticalScrollableHeight="315" VerticalScrollBarMode="Auto"  />
                                <ClientSideEvents Init="function(s,e){AdjustSize(240,gvList);}" />
                            </dx:ASPxGridView>
                        </div>
                        <div style="height: 3px;"></div>
                        <div style="text-align: right">
                            <table style="width: 100%">
                                <tr>
                                    <td style="width: 70px">
                                        <dx:ASPxButton ID="btnQuanXuan" OnClick="btnQuanXuan_Click" ClientInstanceName="btnQuanXuan" runat="server" Text="全选"
                                            UseSubmitBehavior="false">
                                        </dx:ASPxButton>
                                    </td>
                                    <td style="width: 70px">
                                        <dx:ASPxButton ID="btnFanXuan" OnClick="btnFanXuan_Click" ClientInstanceName="btnFanXuan" runat="server" Text="反选"
                                            UseSubmitBehavior="false">
                                        </dx:ASPxButton>
                                    </td>
                                    <td>
                                        <table style="width: 100%">
                                            <tr>
                                                <td>条件选择
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>从用户号</td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtStartNo" Width="100%" ClientInstanceName="txtStartNo" runat="server" MaxLength="15">
                                                        <ClientSideEvents KeyPress="function(s,e){if(event.keyCode==13){txtEndNo.Focus()}}" />
                                                    </dx:ASPxTextBox>
                                                </td>
                                                <td>开始向后选
                                                </td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtEndNo" Width="100%" ClientInstanceName="txtEndNo" runat="server" MaxLength="15">
                                                        <ClientSideEvents KeyPress="function(s,e){if(event.keyCode==13){BindCheck(1);}}" />
                                                    </dx:ASPxTextBox>
                                                </td>
                                                <td>行数据
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>从用户号</td>
                                                <td>
                                                    <dx:ASPxTextBox ID="txtStartNo1" Width="100%" ClientInstanceName="txtStartNo1" runat="server" MaxLength="15">
                                                       <ClientSideEvents KeyPress="function(s,e){if(event.keyCode==13){BindCheck(2);}}" />
                                                    </dx:ASPxTextBox>
                                                </td>
                                                <td>开始到最后
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                    <td style="width: 150px">
                                        <dx:ASPxButton ID="BtnYuLan" ClientInstanceName="BtnYuLan" OnClick="BtnYuLan_Click" runat="server" Text="预览"
                                            UseSubmitBehavior="false">
                                        </dx:ASPxButton>
                                        <dx:ASPxButton ID="BtnDaYin" ClientInstanceName="BtnDaYin" OnClick="BtnDaYin_Click" runat="server" Text="打印"
                                            UseSubmitBehavior="false">
                                        </dx:ASPxButton>
                                    </td>

                                </tr>
                            </table>
                            <div style="display:none">
                                 <dx:ASPxButton ID="BtnXZ" OnClick="BtnXZ_Click" ClientInstanceName="BtnXZ" runat="server" Text="预览"
                                            UseSubmitBehavior="false">
                                        </dx:ASPxButton>
                            </div>
                        </div>

                    </div>
                </div>
            </ContentTemplate>
        </asp:UpdatePanel>
    </form>
</body>
</html>
